import React, { Component } from 'react';
import edit from './subCard.module.scss'
import { withRouter,Redirect } from 'react-router-dom'
import success from '../../static/success.png'
class EditQuota extends Component {
    constructor(props) {
        super(props);
        this.state = {
            price: 0,
            state: false
        }
    }
    render() {
        let that = this
        function State() {
            console.log(that.state)
            if (that.state.state) {
                return (
                    <div className={edit.center}>
                        <img src={success} className={edit.icon}></img>
                        <span>解绑成功</span>
                    </div>
                )
            } else {
                return (
                    <div className={edit.center}>
                        <img src={success} className={edit.icon}></img>
                        <span>修改成功</span>
                        <p>修改后额度为每月<i>{that.state.price}元</i></p>
                    </div>
                )
            }
        }
        return (
            <div className={edit.editQuota}>
                <State />
            </div>
        );
    }
    componentDidMount() {
        this.setState({
            price: this.props.location.state.price,
            state: this.props.location.state.state
        })
    }
    componentWillUnmount() {
        document.title = "解绑亲属卡"
        if(this.state.state){
            
        }
        
    }
}

export default withRouter(EditQuota);